<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>

<body>

</body>

</html>
<script>
    // 父类
    class Person {

        constructor(name, age, sex) {
            this.name = name
            this.age = age
            this.sex = sex
        }

        say() {
            console.log(`我是${this.name}`);
        }

        static type = "人"

        static eat() {
            console.log(`每天要吃早饭`);
        }
    }


    // 子类：
       //  class 子类 extends 父类{}  子类没有自己的内容，把父类所有的内容都继承过来了
   
       class Student extends Person{
   
       }
   
       let s=new Student("小明",17,"男")
       console.log(s);//{name: '小明', age: 17, sex: '男'}
       s.say()//我是小明
   
       console.log(Student.type);//人
       Student.eat()//每天要吃早饭

       
</script>